#!/usr/bin/perl
# page.pl
use warnings;
use strict;

use Term::ReadKey;

my ($width, $height) = GetTerminalSize;

my $count = 0;

ReadMode 'cbreak';

while (<>) {
   print "$.: $_";   # $. added to make example more interesting
   if (++$count == $height) {
      last if lc(ReadKey 0) eq 'q';
      $count = 0;
   }
}

ReadMode 'restore';
